var app = getApp()
var modal = require('../../utils/modal');
var request = require('../../utils/request');
var utils = require('../../utils/utils');
var banner = require('../widget/banner/banner');
var commodity = require('../widget/commodityDisplay/commodityDisplay');
var storage = require('../../utils/storage');

var shareContent = {
    'title':'企鹅优品-优质生活指南',
    'desc':'腾讯精品体验平台，为用户提供优质的生活方式和购物体验。',
    'path':'/pages/project-index/index'
}
var shareObj = utils.share(shareContent);
var pageSetting = {
    data: {
        lists:[{},{},{}]
    },
    onLoad: function(options) {

        var topicId = options.topic_id;
        var that = this;

        /*为组件填充数据*/
        var tempBanner = that.data['comBanner'];
        var tempCommodity = that.data['comCommodity'];
        wx.getStorage({
            key:'topicId'+topicId,
            success:function(res){
                var data = res.data;
                wx.setNavigationBarTitle({
                    title: data['name']
                })
                console.log(data)
                tempBanner['data'] = data;
                tempCommodity['data']=data;
                that.setData({
                    comBanner:tempBanner,
                    comCommodity:tempCommodity
                });
            }
        });         
    }
};

utils.assign(pageSetting,shareObj,banner,commodity);
Page(pageSetting);
